package com.niubi.yygh.oss.controller;

import com.niubi.yygh.common.result.R;
import com.niubi.yygh.oss.service.FileService;
import com.niubi.yygh.vo.user.UserAuthVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@Api(description="阿里云文件管理")
@RestController
@RequestMapping("/admin/oss/file")
public class FileUploadController {
  @Autowired
  FileService fileService;

  @ApiOperation(value = "文件上传")
  @PostMapping("upload")
  public R upload(MultipartFile file){
    String url = fileService.upload(file);
    return R.ok().data("url",url);
  }

  @PostMapping("auth/userAuth")
  public R userAuth(@RequestBody UserAuthVo userAuthVo){
    return R.ok();
  }
}
